Skip to content

Instantly share code, notes, and snippets.

@kennypete
kennypete / navigating_the_modes_of_Vim.md
Created April 18, 2024 20:46
Navigating the modes of Vim

Navigating the modes of Vim

This diagram illustrates navigating through Vim’s modes. It was built factoring Vim 9 (i.e., all its modes, including up to two new modes, cr and cvr, in November 2023). Information about the state() and 'showmode' is provided too.

SVG version

Some features are only available in the SVG version. It is not provided directly from within this gist’s files because SVGs do not always play nicely in GitHub (particularly, refusing to display embedded fonts).

The SVG version includes hover text help, which shows pertinent information about the underlying key, command, mode, etc.

@matt-dray
matt-dray / mutate-if-any.R
Created January 19, 2022 09:52
Pattern for `mutate()` with `if_any()` using {dplyr}
# Goal: put 1 in new col where 1 appears across other cols
library(dplyr)
df <- tibble(
x1 = c(1, NA, NA),
x2 = c(NA, 1, NA),
x3 = c(NA, 1, NA)
)
@YouDevs
YouDevs / post.blade.php
Last active May 11, 2024 04:59
Curso Laravel - Proyecto blog - Listado de categorías - vistas
<!-- agrega aquí el header con el logo -->
<!-- Contenido -->
<section class="container-fluid content py-5">
<div class="row justify-content-center">
<!-- Post -->
<div class="col-12 col-md-7 text-center">
<h1>POO con Javascript, feo pero posible</h1>
<hr>
<img src="images/8.png" alt="Post Javascript" class="img-fluid">
@hibiyasleep
hibiyasleep / GodDrinksJava.java
Last active May 11, 2024 04:53
world.execute(me);
package goddrinksjava;
/**
* The program GodDrinksJava implements an application that
* creates an empty simulated world with no meaning or purpose.
*
* @author momocashew
* @lyrics hibiyasleep
*/
@mikepruett3
mikepruett3 / shell-setup.ps1
Last active May 11, 2024 04:45
Packages to install via scoop, winget, choco, and other tools...
<#
.SYNOPSIS
Script to Initialize my custom powershell setup.
.DESCRIPTION
Script uses scoop
.NOTES
**NOTE** Will configure the Execution Policy for the "CurrentUser" to Unrestricted.
Author: Mike Pruett
Date: October 18th, 2018
const crypto = require('crypto');
// this usually takes a few seconds
function work(limit = 100000) {
let start = Date.now();
n = 0;
while(n < limit) {
crypto.randomBytes(2048);
n++;
}
#!/usr/bin/awk -f
# This program is a copy of guff, a plot device. https://github.com/silentbicycle/guff
# My copy here is written in awk instead of C, has no compelling benefit.
# Public domain. @thingskatedid
# Run as awk -v x=xyz ... or env variables for stuff?
# Assumptions: the data is evenly spaced along the x-axis
# TODO: moving average
@amishshah
amishshah / ogg-containers.md
Last active May 11, 2024 04:38
A guide to the Ogg container format for demuxing opus audio

You take a stream/buffer of binary data. The start of your data is a "Page", which has a header followed by data.

Header

You need to read the following data from the header (see https://xiph.org/ogg/doc/framing.html for more detail)

  • capture_pattern - bytes 0 to 3, must read OggS
  • stream_structure_version - byte 4, must be 0
  • header_type_flag - byte 5, a bitflag that tells you metadata about the page (is it a new packet? is a packet continued here? is it the first/last page of the stream?)
  • absolute granule position - bytes 6 to 13, not needed unless you want seeking
  • stream serial number - bytes 14 to 17, a serial number given to each stream contained in the Ogg file. This is important for playing Ogg files that contain other streams, such as video or cover art. You need to identify and only bother parsing the Opus stream.